
#import "Isgl3dPrimitive.h"


//#ifdef __cplusplus
//#include "PerlinNoise.h"
//#endif
/**
 * The Isgl3dTerrainMeshRandom creates a 3-dimensional terrain mesh (elevations in the y-direction) centered on the origin
 * on the x-z plane, using perlin noise generator as the elevation data.
 * 
 * Total number of vertices = (nx + 1) * (ny + 1). 
 */
@interface Isgl3dTerrainMeshRandom : Isgl3dPrimitive {
    
@public
	float _width;
	float _depth; 

	int _nx;
	int _nz;
    
    float _dx,_dz;
    

    float wx, wz;               //world position;
    float* terrainHeightData;
    float* terrainNormalData;
}

+ (id) create:(float)width depth:(float)depth nx:(int)nx nz:(int)nz worldx:(float)x worldz:(float)z;

/**
 * Initialises the Isgl3dTerrainMesh with a specified geometry and terrain data file.
 * @param terrainDataFile The file name of the image containing the terrain data.
 * @param channel The color channel of the image to use to obtain the data.
 * @param width The width of the resulting terrain in the x-direction.
 * @param depth The depth of the resulting terrain in the z-direction.
 * @param height The maximum height of the resulting terrain in the y-direction. All color values coming from the image file are scaled between 0 and this value.
 * @param nx The number of segments along the x-axis.
 * @param nz The number of segments along the z-axis.
 */
- (id) initTerrain:(float)width depth:(float)depth nx:(int)nx nz:(int)nz worldx:(float)x worldz:(float)z;

- (float) getHeight:(float)x z:(float)z;
@end
